home *** CD-ROM | disk | FTP | other *** search
- Path: engnews2.Eng.Sun.COM!usenet
- From: nitin@more.eng.sun.com (Nitin More [CONTRACTOR])
- Newsgroups: comp.lang.c++
- Subject: Re: Creating a pointer to a function "void (*ptrFunction)()" inside a class
- Date: 09 Jan 1996 18:32:42 GMT
- Organization: SunSoft
- Message-ID: <NITIN.96Jan9103242@more.eng.sun.com>
- References: <30ECA10F.3D99@ifu.net> <NITIN.96Jan5125830@more.eng.sun.com>
- <4crquj$7t1@lib108.its.rpi.edu>
- NNTP-Posting-Host: more.eng.sun.com
- In-reply-to: floydb1@lib108.its.rpi.edu's message of 8 Jan 1996 14:22:59 -0500
-
- In article <4crquj$7t1@lib108.its.rpi.edu> floydb1@lib108.its.rpi.edu (Barry B Floyd) writes:
-
- > From: floydb1@lib108.its.rpi.edu (Barry B Floyd)
- > Newsgroups: comp.lang.c++
- > Date: 8 Jan 1996 14:22:59 -0500
- > Organization: Rensselaer Polytechnic Institute, Troy, NY.
- >
-
- [original message deleted]
-
- >
- >
- > Try:
- >
- > class BaseClass
- > {
- > ... // other stuff
- > virtual int Function ( int, int ) = 0 ; // pure virtual fn()
- > ... // other stuff
- > }
- >
- > class DerivedClass : BaseClass
- > {
- > ... // other stuff
- > int Function ( int, int ) { // your code } ;
- > ... // other stuff
- > }
- >
- [text deleted]
-
- > ps
- >
- > note: "Function ( int, int )" remains virtual in DerivedClass,
- > even though the keyword "virtual" is not included in the declaration.
- > Thus, I believe "class DerivedDerivedClass : DerivedClass" must provide
- > a "Function ( int, int )" as well.
-
-
- I believe the last paragraph is wrong. Somebody please correct me if I am
- wrong.
-
- (1) The "Function ( int, int )" *does not* remain virtual in DerivedClass
- unless the keyword "virtual" is included in the declaration.
-
- (2) The "class DerivedDerivedClass : DerivedClass" *does not* have to provide
- a "Function ( int, int )" as well as long as one of its derived classes
- has provided definition for the pure virtual function.
-
- -Nitin
-
- --
- ----------------------------------------------------------------------
- Nitin More
- SunSoft, Bldg 16 Off: (415) 786 7109
- Menlo Park, CA Fax: (415) 786 7957 e-mail: nitin@more.eng.sun.com
- ----------------------------------------------------------------------
-